The macOS WM has no root window. We fake one with a 1x1 window at the
origin that has no associated NSWindow. If the pointer is not on a
realized GdkWindow the hierarchical search will place it in the root
window even if it's nowhere near it. That's not valid, but returning it
from find_toplevel_under_pointer prevents Gdk from discovering when the
pointer is really over a GdkWindow. Return NULL instead so that the window
discovery is re-performed.
}
- if (toplevel == NULL)
- return NULL;
-
- /*
- * Root window type does not need translation, but also does not have
- * an associated NSWindow and therefore can't translate screen points
+ /* If the stored toplevel is NULL or _gdk_root it's not useful,
+ * return NULL to regenerate.
*/
- if (toplevel == _gdk_root)
- return toplevel;
+ if (toplevel == NULL || toplevel == _gdk_root )
+ return NULL;
get_window_point_from_screen_point (toplevel, screen_point, x, y);
/* If the coordinates are out of window bounds, this toplevel is not